package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type TextCensorMessage struct {
	ConclusionType uint64 `json:"conclusionType"`
}

func TextCensor(message string) bool {
	client := censor.NewClient("LTAI5tExz3UgGhZuo3Yn8s2d", "U3kaACeghhOjtYwEix3K4UZLOdSO2G")

	res := client.TextCensor(message)
	fmt.Println(res)

	var data TextCensorMessage
	_ = json.Unmarshal([]byte(res), &data)

	if data.ConclusionType == 1 {
		return true
	}
	return false

}
